package com.example.city_defense;

public class CountTime{
	
	private float time;
	private GameScreen gameScreen;
	public CountTime(GameScreen gameScreen) {
		this.gameScreen = gameScreen;
		this.time = Setting.time;	
	}

	

	public void skip() {
		// Add tick time in attributies
		// Start new Attack
		// CountTime = Setting.Time
		this.time = Setting.time;
		gameScreen.startAttack();

	}

	public String getTime() {
		int minute = (int)(time / 60);
		int second = (int)(time - minute * 60);
		// String time = minute+":"+Second;
		String timeForm = minute + ":" + second;
		if (second < 10) {
			timeForm = minute + ":0" + second;
		}
		return timeForm;
	}

	public void update(float deltaTime){
		time = time -deltaTime;
		if(time <=0){
			time = Setting.time;
			gameScreen.startAttack();
		}
	}
}
